package ca.etsmtl.log720.lab1;

import java.util.ArrayList;
import org.omg.PortableServer.POA;

public class DossierImpl extends DossierPOA {

	private int _id;
	private String _nom;
  	private String _noPermis;
    private String _noPlaque;
    private String _prenom;
  	private int _niveau;
  	
  	private static int _lastId = 0;
  	
  	private ArrayList<Integer> _listeInfraction;
  	private ArrayList<Integer> _listeReaction;
  	
  	/* Constructeurs */
  	
  	public DossierImpl(String nom, String prenom, String noPlaque, String noPermis) {
  		
  		_nom = nom;
  		_prenom = prenom;
  		_noPlaque = noPlaque;
  		_noPermis = noPermis;
  		_niveau = 0;
  		_id = _lastId++;
  		
  		_listeInfraction = new ArrayList<Integer>();
  		_listeReaction = new ArrayList<Integer>();
  	}
  	
  	/* methodes */
  	
	public int[] getListeInfraction() {
		int[] intArray = new int[_listeInfraction.size()];
		for (int i = 0; i < _listeInfraction.size(); i++) {
			intArray[i] = _listeInfraction.get(i);
		}
		return intArray;
	}

	public int[] getListeReaction() {
		int[] intArray = new int[_listeReaction.size()];
		for (int i = 0; i < _listeReaction.size(); i++) {
			intArray[i] = _listeReaction.get(i);
		}
		return intArray;
	}
  	
  	public void ajouterReactionAListe(int idReaction) {
  		
  		_listeReaction.add(new Integer(idReaction));
  	}
  	
  	public void ajouterInfractionAListe(int idInfraction) {
  		
  		_listeInfraction.add(new Integer(idInfraction));
  	}
  	
  	public String _toString() {
  		return _id + ". " + _prenom + " " + _nom + ": Permis = " + _noPermis + "; Plaque = " + _noPlaque ;
  	}
  	
  	/* GETTERS */
  	
  	public int id() {
  		return _id;
  	}
  	
  	public String noPermis() {
  		return _noPermis;
  	}
  	
  	public String noPlaque() {
  		return _noPlaque;
  	}
  	
  	public String nom() {
  		return _nom;
  	}
  	
  	public String prenom() {
  		return _prenom;
  	}
  	
  	public int niveau() {
  		// MAJ du niveau avant
  		return _niveau;
  	}
  	
}
